package com.chouxiaozi.dbroute;

import com.chouxiaozi.dbroute.proxy.OrderServiceCglibProxy;
import com.chouxiaozi.dbroute.proxy.OrderServiceDynamicProxy;

import java.text.SimpleDateFormat;
import java.util.Date;

public class TestDbroute {
    public static void main(String[] args) throws Exception{
        Order order = new Order();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");
        Date date = sdf.parse("2017/02/01");
        order.setCreateTime(date.getTime());

        /*OrderServiceStaticProxy orderServiceStaticProxy = new OrderServiceStaticProxy(new OrderService());
        orderServiceStaticProxy.createOrder(order);*/

        /*OrderServiceDynamicProxy orderServiceDynamicProxy = new OrderServiceDynamicProxy();
        IOrderService orderService = (IOrderService) orderServiceDynamicProxy.getInstance(new OrderService());
        orderService.createOrder(order);*/

        OrderServiceCglibProxy orderServiceCglibProxy = new OrderServiceCglibProxy();
        OrderService orderService = (OrderService) orderServiceCglibProxy.getInstance(OrderService.class);
        orderService.createOrder(order);
    }
}
